/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FinSesionPanel.java
 *
 * Created on 25-ene-2011, 18:52:22
 */

package Vista;

/*
 *  Proyecto eJAM [G12]
 *  Miembros:
 *      - Javier Ruiz Hidalgo
 *      - Adrian Ramos Cápitas
 *      - Miguel Alejandro Esteban Ordóñez
 */

public class FinSesionPanel extends javax.swing.JPanel {

    private VistaPrincipal vistaPrincipal;
    /** Creates new form FinSesionPanel */
    public FinSesionPanel(VistaPrincipal vistaPrincipal) {
        this.vistaPrincipal = vistaPrincipal;
        initComponents();

        this.jTexto.setText(SesionActual.instancia().obtieneSesion().getUsuario().toStringReducido());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jCerrarSesion = new javax.swing.JButton();
        jTexto = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        setEnabled(false);
        setPreferredSize(new java.awt.Dimension(480, 50));
        setRequestFocusEnabled(false);

        jCerrarSesion.setText("Cerrar Sesión");
        jCerrarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCerrarSesionActionPerformed(evt);
            }
        });

        jTexto.setFont(new java.awt.Font("Tahoma", 3, 11));
        jTexto.setForeground(new java.awt.Color(102, 102, 102));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTexto, javax.swing.GroupLayout.PREFERRED_SIZE, 316, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addComponent(jCerrarSesion, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTexto, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jCerrarSesion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jCerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCerrarSesionActionPerformed
        this.vistaPrincipal.desconectar();
    }//GEN-LAST:event_jCerrarSesionActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jCerrarSesion;
    private javax.swing.JLabel jTexto;
    // End of variables declaration//GEN-END:variables

}
